var dbConfig = require("../utils/dbconfig");
var jwt = require("jsonwebtoken");
var expressJwt = require("express-jwt");
const secretKey = "huangzh";
const createToken = (payload) =>
  jwt.sign(payload, secretKey, {
    expiresIn: 28800000,
  });
//   验证token
const jwtAuth = expressJwt({
  secret: secretKey,
  algorithms: ["HS256"],
  credentialsRequired: true, //false为不校验
}).unless({
  path: ["/users/login", "/users/reg"], //不需要校验的路径
});
module.exports = {jwtAuth,createToken}
